//
//  FXCTabBarViewController.m
//  XinLangFeiBo
//
//  Created by dllo on 16/2/26.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "FXCTabBarViewController.h"
#import "FXCHomeTableViewController.h"
#import "FXCProfileTableViewController.h"
#import "FXCMyInfoController.h"

#import "FXCNewViewController.h"
@interface FXCTabBarViewController ()

@end

@implementation FXCTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    
//    首页
    FXCHomeTableViewController *home = [FXCHomeTableViewController new];
    [self addChild:home title:@"首页" image:@"tabbar_home" imageSele:@"tabbar_home_selected"];
    
    
//    新闻
    FXCNewViewController *new = [FXCNewViewController new];
    [self addChild:new title:@"新闻" image:@"tabbar_discover" imageSele:@"tabbar_discover_selected"];
    
//    我的
//    FXCProfileTableViewController *pro = [FXCProfileTableViewController new];
//    [self addChild:pro title:@"我" image:@"tabbar_profile" imageSele:@"tabbar_profile_selected"];
    
//    我的2
    FXCMyInfoController *my = [FXCMyInfoController new];
    [self addChild:my title:@"我" image:@"tabbar_profile" imageSele:@"tabbar_profile_selected"];
    
}

- (void)addChild:(UIViewController *)childVC
           title:(NSString *)title
           image:(NSString *)image
       imageSele:(NSString *)imageSele{
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:childVC];
    childVC.title = title;
    //    childVC.view.backgroundColor = [UIColor redColor];
    childVC.tabBarItem.image =
    [UIImage imageNamed:image];
    childVC.tabBarItem.selectedImage =
    [[UIImage imageNamed:imageSele] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg_nav"] forBarMetrics:0];
    
    // 取消tabbar文字渲染效果,属性字符串
    //    NSMutableDictionary *dicTemp = [NSMutableDictionary dictionary];
    //    dicTemp[NSForegroundColorAttributeName] = [UIColor orangeColor];
    
    //    NSMutableDictionary *dicTempTwo =
    //    [NSMutableDictionary dictionary];
    //    dicTempTwo[NSForegroundColorAttributeName]=
    //    [UIColor yellowColor];
    
    //    [childVC.tabBarItem
    //     setTitleTextAttributes:dicTemp forState:UIControlStateNormal];
    //    [childVC.tabBarItem setTitleTextAttributes:dicTempTwo forState:
    //     UIControlStateSelected];
    
    [self addChildViewController:nav];
    
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
